module ui {

    export class TabbarButton {

        public static readonly Unselect_Color: number = 0xffffff;

        public static readonly Selected_Color: number = 0xf7b61d;


        private img: eui.Image;

        private label: egret.TextField;

        private _selected: boolean = false;

        public group:eui.Group;

        public constructor(group: eui.Group, isSelected: boolean) {
            this.group = group;
            this.img = <eui.Image>group.getChildAt(0);
            this.label = <egret.TextField> group.getChildAt(1);
            this.selected = isSelected;
        }


        public set selected(isSelected: boolean) {
            this._selected = isSelected;
            if (isSelected) {
                this.img.texture = manager.ResManager.getTexture("rank_sheet.tab_selected");
                this.label.textColor = TabbarButton.Selected_Color;
            } else {
                this.img.texture = manager.ResManager.getTexture("rank_sheet.tab_unselected");
                this.label.textColor = TabbarButton.Unselect_Color;
            }
        }

    }

}